// 所有关于详情的接口
import { request } from "./request";
// 获取歌单详情接口
export function _getMusicListDetail(id) {
  return request({
    url: "/playlist/detail",
    params: {
      id: id,
    },
  });
}

/**获取歌单歌曲信息 */
export function _getSongsDetail(arr) {
  return request({
    url: "/song/detail",
    params: {
      ids: arr,
    },
  });
}
// 歌单id获取歌曲详情
export function _getAllSong(id) {
  return request({
    url: "/playlist/track/all",
    params: {
      id: id,
    },
  });
}

/**歌单评论信息 */
export function _getRecommends(id, limit, offset) {
  return request({
    url: "/comment/playlist",
    params: {
      id: id, //歌单id
      limit: limit, //条数
      offset, //页码
    },
  });
}
//
/**获取歌单收藏者
 */
export function _getSub(id, limit) {
  return request({
    url: "/playlist/subscribers",
    params: {
      id: id, //歌单id
      limit, //条数
    },
  });
}

/**对歌单发表评论 */
export function _pushCommend(cookie, id, content) {
  return request({
    url: "/comment",
    params: {
      cookie: cookie, //登录后返回的标识
      t: 1,
      type: 2,
      id: id, //歌单id
      content: content, //评论内容
    },
  });
}
// 处理歌单的类
export class baseInfoCom {
  constructor(playlist) {
    this.img = playlist.coverImgUrl || "";
    this.title = playlist.description;
    this.name = playlist.name;
    this.shareCount = playlist.shareCount;
    this.subscribedCount = playlist.subscribedCount;
    this.playCount = playlist.playCount;
    this.trackCount = playlist.trackCount;
    this.tags = playlist.tags;
    this.createTime = playlist.createTime;
    this.creatorAvatar = playlist.creator.avatarUrl;
    this.creatorName = playlist.creator.nickname;
  }
}
/**获取歌词 */
export function _getLyric(id) {
  return request({
    url: "/lyric",
    params: {
      id: id, //歌曲id
    },
  });
}

/**歌曲评论 */
export function _musicRecommend(id, limit, offset) {
  return request({
    url: "/comment/music",
    params: {
      id: id, //歌曲id
      limit: limit, //条数
      offset, //页码
    },
  });
}
